package cn.edu.gdut.csq.controller;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.edu.gdut.csq.entity.vo.StatisticData;
import cn.edu.gdut.csq.service.StatisticService;

@Controller
@RequestMapping("/statistic")
public class StatisticController {

	@Autowired
	private StatisticService statisticService;

	@RequestMapping("/today")
	private String computeDistrictJobNum(HttpServletRequest req,
			HttpServletResponse res) {

		String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date(System
				.currentTimeMillis()));
		List<StatisticData> computeDistrictJobNum = statisticService
				.computeDistrictJobNum(time);
		req.getSession().setAttribute("datas", computeDistrictJobNum);

		return "statistics/today";
	}
}
